/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.edu.fundacionincap.VO;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author langeblanc
 */
@Entity
@Table(name = "programaacademico", catalog = "AsignacionCarga", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Programaacademico.findAll", query = "SELECT p FROM Programaacademico p"),
    @NamedQuery(name = "Programaacademico.findByMalla", query = "SELECT p FROM Programaacademico p WHERE p.malla = :malla"),
    @NamedQuery(name = "Programaacademico.findByCarrera", query = "SELECT p FROM Programaacademico p WHERE p.carrera = :carrera"),
    @NamedQuery(name = "Programaacademico.findByIdProgramaAcademico", query = "SELECT p FROM Programaacademico p WHERE p.idProgramaAcademico = :idProgramaAcademico")})
public class Programaacademico implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "Malla")
    private String malla;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "carrera")
    private String carrera;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "idProgramaAcademico")
    private String idProgramaAcademico;
    @JoinColumn(name = "convenio", referencedColumnName = "idConvenio")
    @ManyToOne(optional = false)
    private Convenio convenio;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "programaAcademico")
    private Collection<Asignatura> asignaturaCollection;

    public Programaacademico() {
    }

    public Programaacademico(String idProgramaAcademico) {
        this.idProgramaAcademico = idProgramaAcademico;
    }

    public Programaacademico(String idProgramaAcademico, String malla, String carrera) {
        this.idProgramaAcademico = idProgramaAcademico;
        this.malla = malla;
        this.carrera = carrera;
    }

    public String getMalla() {
        return malla;
    }

    public void setMalla(String malla) {
        this.malla = malla;
    }

    public String getCarrera() {
        return carrera;
    }

    public void setCarrera(String carrera) {
        this.carrera = carrera;
    }

    public String getIdProgramaAcademico() {
        return idProgramaAcademico;
    }

    public void setIdProgramaAcademico(String idProgramaAcademico) {
        this.idProgramaAcademico = idProgramaAcademico;
    }

    public Convenio getConvenio() {
        return convenio;
    }

    public void setConvenio(Convenio convenio) {
        this.convenio = convenio;
    }

    @XmlTransient
    public Collection<Asignatura> getAsignaturaCollection() {
        return asignaturaCollection;
    }

    public void setAsignaturaCollection(Collection<Asignatura> asignaturaCollection) {
        this.asignaturaCollection = asignaturaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idProgramaAcademico != null ? idProgramaAcademico.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Programaacademico)) {
            return false;
        }
        Programaacademico other = (Programaacademico) object;
        if ((this.idProgramaAcademico == null && other.idProgramaAcademico != null) || (this.idProgramaAcademico != null && !this.idProgramaAcademico.equals(other.idProgramaAcademico))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "co.edu.fundacionincap.VO.Programaacademico[ idProgramaAcademico=" + idProgramaAcademico + " ]";
    }
    
}
